<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // let name = 'lisi'
    // let age = 20
    // const obj1 = {
    //   name: name,
    //   age: age,
    //   eat: function () {

    //   }
    // }
    // const obj1 = {
    //   name,
    //   age,
    //   eat() {

    //   }
    // }
    // console.log(obj1);

    const obj2 = {
      name: 'lisi',
      age: 10
    }
    // let name = obj2.name
    // let age = obj2.age

    // let { age, name } = obj2
    // console.log(name, age);

    // let { name: name1, age: age1 } = obj2
    // console.log(name1, age1);
    // console.log(obj2);

    const arr1 = [1, 2, 3, 4, 5, 6, 7]

    // const [a1, a2, a3] = arr1
    // console.log(a1, a2, a3);

    const [a1, , a3] = arr1
    console.log(a1, a3);



    const str1 = 'abcde'
    const [s1, , s2, s3, s4] = str1
    console.log(s1, s2, s3, s4);


    function fn1([a1, a2, a3]) {
      console.log(a1, a2, a3);
    }
    fn1([1, 2, 3])

    function fn2({ name, age }) {
      console.log(name, age);
    }

    fn2({ name: 'zhaosi', age: 60 })


    function fn4(name, age = 18) {
      // age = age || 18
      console.log(name + ' ' + age + '岁');
    }
    fn4('lisi')



  </script>
</body>

</html>